package ������վ;

import java.io.IOException;
import java.io.PrintWriter;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
public class LoginServlet extends HttpServlet {
 
	public static void main(string[] args)
	{
	}
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		//�������Ա���
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		
		//���ǰ̨������˺�����
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		
		//�ж�ǰ̨������˺������Ƿ���ȷ 
		
		if("123".equals(password) && "zhangsan".equals(username)){
			response.getWriter().print("<h1><font color='red'> ��¼�ɹ���</font></h1>");
		}else{
			response.getWriter().print("<font color='red'> �û������������</font>");
			/*
			 * ������󣬾ͷ������µ�¼�Ľ��棡
			 */
			response.getWriter().print("<form action='/jsp_demo/LoginServlet' method='get' > ������<input name='username' ><br>���룺<input name='password' type='password'><br><input type='submit' value='�ύ'><br></form>>");
		}
		
		
		
		
		
	}
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}
 
}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
